<?php

function c_to_html($text, $symbols_per_column=1000) {
    $formatted_text = $text;
    $formatted_text = wordwrap($formatted_text, $symbols_per_column, "\n", true);
    $formatted_text = str_replace(array("\r\n", "\r"), "\n", $formatted_text);
    $formatted_text = preg_replace("/\n\s*\t*\n\s*\t*\n/", "\n\n", $formatted_text);
    $formatted_text = str_replace("\n", "<br/>", $formatted_text);

    return $formatted_text;
}
?>
